package dao

// 这是 OmsOrderItem 的全局公开dao对象，被service层调用!
var OmsOrderItemDao = omsOrderItemDao{}

// 这是 oms_order_item表 的实体类
type OmsOrderItem struct {
	CouponAmount      float64 `json:"coupon_amount" form:"coupon_amount" v:"coupon_amount"` // 优惠券优惠分解金额
	GiftGrowth        int32   `json:"gift_growth" form:"gift_growth" v:"gift_growth"`
	GiftIntegration   int32   `json:"gift_integration" form:"gift_integration" v:"gift_integration"`
	Id                int64   `json:"id" form:"id" v:"id"`
	IntegrationAmount float64 `json:"integration_amount" form:"integration_amount" v:"integration_amount"` // 积分优惠分解金额
	OrderId           int64   `json:"order_id" form:"order_id" v:"order_id"`                               // 这是一个逻辑外键,关联oms_order(id)订单id
	OrderSn           string  `json:"order_sn" form:"order_sn" v:"order_sn"`                               // 订单编号
	ProductAttr       string  `json:"product_attr" form:"product_attr" v:"product_attr"`                   // 商品销售属性: 颜色,容量
	ProductBrand      string  `json:"product_brand" form:"product_brand" v:"product_brand"`
	ProductCategoryId int64   `json:"product_category_id" form:"product_category_id" v:"product_category_id"` // 商品分类id
	ProductId         int64   `json:"product_id" form:"product_id" v:"product_id"`
	ProductName       string  `json:"product_name" form:"product_name" v:"product_name"`
	ProductPic        string  `json:"product_pic" form:"product_pic" v:"product_pic"`
	ProductPrice      float64 `json:"product_price" form:"product_price" v:"product_price"`          // 销售价格
	ProductQuantity   int32   `json:"product_quantity" form:"product_quantity" v:"product_quantity"` // 购买数量
	ProductSkuCode    string  `json:"product_sku_code" form:"product_sku_code" v:"product_sku_code"` // 商品sku条码
	ProductSkuId      int64   `json:"product_sku_id" form:"product_sku_id" v:"product_sku_id"`       // 商品sku编号
	ProductSn         string  `json:"product_sn" form:"product_sn" v:"product_sn"`
	PromotionAmount   float64 `json:"promotion_amount" form:"promotion_amount" v:"promotion_amount"` // 商品促销分解金额
	PromotionName     string  `json:"promotion_name" form:"promotion_name" v:"promotion_name"`       // 商品促销名称
	RealAmount        float64 `json:"real_amount" form:"real_amount" v:"real_amount"`                // 该商品经过优惠后的分解金额

}

// 注意:这是 OmsOrderItem 的私有dao对象，只能在dao层内使用!
type omsOrderItemDao struct {
	InsertTemplate func(arg OmsOrderItem) (int64, error)                               //插入一条记录
	UpdateTemplate func(arg OmsOrderItem) (int64, error)                               //更新一条记录
	DeleteTemplate func(id int64) (int64, error)                                       `args:"id"`                         //根据传入的主键删除一条记录
	SelectTemplate func(id int64) (OmsOrderItem, error)                                `args:"id"`                         //根据传入的主键获取一条记录
	List           func(keyword string, pageNum, pageSize int) ([]OmsOrderItem, error) `args:"keyword,page_num,page_size"` //模糊分页查询
}

/*
// 这是 oms_order_item 表的Postman测试参数
// 该结构体中的字段就是: 前后端交互的json字段!
type OmsOrderItemPostman struct {
coupon_amount
gift_growth
gift_integration
id
integration_amount
order_id
order_sn
product_attr
product_brand
product_category_id
product_id
product_name
product_pic
product_price
product_quantity
product_sku_code
product_sku_id
product_sn
promotion_amount
promotion_name
real_amount

}*/

// 这是 oms_order_item 表的批量请求参数
type OmsOrderItemReq struct {
	List []OmsOrderItem `json:"list" form:"list"`
}
